﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace StoreManagement_Application
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
          
        }
       
        private Form Panel2activeform;
        private void Form1_Load(object sender, EventArgs e)
        {
            splitContainer1.SplitterWidth = 1;
            splitContainer1.IsSplitterFixed = true;
         
        
        }
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            if (panel2.Tag.ToString() == "open")
            {
                panel2.Height = 0;
                panel2.Tag = "close";
            }
            else
            {
                panel2.Tag = "open";
                panel2.Height = 140;
            }
        }
        private void panel4_MouseClick(object sender, MouseEventArgs e)
        {
            if (panel3.Tag.ToString() == "open")
            {
                panel3.Height = 0;
                panel3.Tag = "close";
            }
            else
            {
                panel3.Tag = "open";
                panel3.Height = 140;
            }
        }
        private void panel6_MouseClick(object sender, MouseEventArgs e)
        {
            if (panel5.Tag.ToString() == "open")
            {
                panel5.Height = 0;
                panel5.Tag = "close";
            }
            else
            {
                panel5.Tag = "open";
                panel5.Height = 140;
            }
        }

       
        #region method for hiding the last form and displaying the current form
        private void DisplayPanel(Form form)
        {
            if (Panel2activeform != null && Panel2activeform.Visible)
            {
                Panel2activeform.Close();
            }
            this.splitContainer1.Panel2.Controls.Add(form);
            Panel2activeform = form;
        }
        #endregion

        private void btnaddproduct_Click(object sender, EventArgs e)
        {
            AddProduct adp = new AddProduct();
            adp.TopLevel = false;
            this.DisplayPanel(adp);
            adp.Show();

        }

        private void btnaddclient_Click(object sender, EventArgs e)
        {
            UserRegistration usr = new UserRegistration();
            usr.TopLevel = false;
            this.DisplayPanel(usr);
            usr.Show();
           

        }

        private void btnAddrate_Click(object sender, EventArgs e)
        {
            AddRate adr = new AddRate();
            adr.TopLevel = false;
            this.DisplayPanel(adr);
            adr.Show();
        }
       
        private void btnViewProduct_Click(object sender, EventArgs e)
        {
            

            ViewProduct vpr = new ViewProduct();
            vpr.TopLevel = false;
            this.DisplayPanel(vpr);
            vpr.Show();
        }

        private void label1_MouseClick(object sender, MouseEventArgs e)
        {
            panel1_MouseClick(sender, e);
        }

        private void label2_MouseClick(object sender, MouseEventArgs e)
        {
            panel4_MouseClick(sender, e);
        }

        private void label3_MouseClick(object sender, MouseEventArgs e)
        {
            panel6_MouseClick(sender, e);


            //fasdfasdfasdfadfads

            
        }

       

      
       
      
    }
}
